//
//  TheirWishListDetailsViewController.m
//  eGifr
//
//  Created by Phien Tram on 8/14/13.
//  Copyright (c) 2013 eGiftr. All rights reserved.
//

#import "TheirWishListDetailsViewController.h"
#import "AppDelegate.h"
#import "FriendInfo.h"
#import "UIImageView+WebCache.h"

@interface TheirWishListDetailsViewController ()

@property (nonatomic, strong) NSDateFormatter *dateFormatter;
@end

@implementation TheirWishListDetailsViewController

- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
    self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
    if (self) {
        // Custom initialization
    }
    return self;
}

- (void)viewDidLoad
{
    [super viewDidLoad];
	// Do any additional setup after loading the view.
    _dateFormatter = [[NSDateFormatter alloc] init];
    [_dateFormatter setDateFormat:@"MM/dd/yyyy"];
    
    
//    _mapView.showsUserLocation = YES;
    
    CGSize contentSize = self.scrollView.contentSize;
    contentSize.height = 700;
    self.scrollView.contentSize = contentSize;
    
    [self setupBorderForView:self.bestGiftView01];
    [self setupBorderForView:self.betterGiftView01];
    [self setupBorderForView:self.goodGiftView01];
    [self setupBorderForView:self.goodGiftView02];
    [self setupBorderForView:self.goodGiftView03];
    [self setupBorderForView:self.goodGiftView04];
    
    
    [self setupBorderForView:self.bestGiftView11];
    [self setupBorderForView:self.betterGiftView11];
    [self setupBorderForView:self.goodGiftView11];
    [self setupBorderForView:self.goodGiftView12];
    [self setupBorderForView:self.goodGiftView13];
    [self setupBorderForView:self.goodGiftView14];
}

- (void)didReceiveMemoryWarning
{
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

- (void)viewDidAppear:(BOOL)animated
{
    [super viewDidAppear:animated];
    
//    [_mapView setCenterCoordinate:SharedCurrentLocation.coordinate];
//    MKCoordinateRegion viewRegion = MKCoordinateRegionMakeWithDistance(SharedCurrentLocation.coordinate, 0.0, 0.0);
//    viewRegion.span.longitudeDelta = 0.01f;
//    viewRegion.span.latitudeDelta = 0.01f;
//    [_mapView setRegion:viewRegion animated:YES];
    
    _nameLabel.text = [NSString stringWithFormat:@"%@ %@", _friendInfo.firstName, _friendInfo.lastName];
    _birthdayLabel.text = [_dateFormatter stringFromDate:_friendInfo.birthday];
    [_profileImageView setImageWithURL:[NSURL URLWithString:_friendInfo.profileImageUrl] placeholderImage:[UIImage imageNamed:@"icon_user_place_holder"]];
}

- (void)setupBorderForView:(UIView *)view
{
    view.layer.borderColor = [UIColor blackColor].CGColor;
    view.layer.borderWidth = 1.0f;
}

- (void)viewDidUnload {
    [self setNameLabel:nil];
    [self setBirthdayLabel:nil];
    [self setProfileImageView:nil];
    [super viewDidUnload];
}
@end
